package com.db.cm.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import com.db.cm.app.model.GoodsDO;
import com.db.cm.app.mapper.GoodsMapper;
import com.db.cm.app.service.GoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author YOURSLIHUA
 * @since 2023-11-24
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, GoodsDO> implements GoodsService  {

    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<GoodsDO> selectAll() {
       return goodsMapper.selectList(null);
    }
    @Override
    public GoodsDO selectById(String goodsId) {
        return goodsMapper.selectById(goodsId);
    }

    @Override
    public boolean update(GoodsDO entity) {

        return goodsMapper.updateById(entity)>0;
    }

    @Override
    public boolean add(GoodsDO entity) {
       return goodsMapper.insert(entity)>1;
    }

    @Override
    public boolean delete(GoodsDO entity) {
        return goodsMapper.deleteById(entity)>0 ;
    }

}
